package com.rzico.account.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum OrderTypeEnum {
    /**
     * 订单类型 {0:订单,1.出货单}
     */
    ORDER_TYPE_ORDER(0, "订单"),
    ORDER_TYPE_COUNSELOR(1, "咨询"),
    ORDER_TYPE_EVALUATION(2, "测评"),
    ORDER_TYPE_ENROLL(3, "报名"),
    ORDER_TYPE_COURSE(4, "课程"),
    ORDER_TYPE_ANSWER(5, "问答");

    private Integer id;
    private String name;

    OrderTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        OrderTypeEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static OrderTypeEnum getById(Integer id) {
        for (OrderTypeEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

    public static void main(String args[]){
        System.out.println(OrderTypeEnum.getNameById(1));
    }
}
